#ifndef BBS_H
#define BBS_H

#include <QVector>
#include <QString>
#include <QStringList>
#include <QVariant>
#include <QObject>
#include <QDateTime>
#include "topic.h"
#include "board.h"
#include "profile.h"

class BBS : public baseOnProfile{
    Q_OBJECT
    public:
	enum ServerStatus{
	    Stop = 0,
	    Starting = 1,
	    Running = 2,
	    Stopping = 4
	};
	QString name;
	QVector<Board *> boardPool;
    public:
	~BBS();
	BBS(Profile * profile, QString bbsName = "new BBS");
	virtual QString display(void);
	Board * favoriteAt(int i);
	Board * boardAt(int i);
    signals:
	void refreshFinished(bool error);
	void newStatus(int statusCode, QString explain);
    protected:
	//将新版块添加至本论坛
	virtual bool addBoard(Board * board);
	int state;
    public slots:
	//刷新版块信息
	virtual void refreshMe() {};
	//登录服务器，并且刷新各种信息
	virtual void start(void) {};
	//退出服务器
	virtual void stop(void) {};
	//先退出，然后再次登录
	virtual void restart(void) {};
};

//grep newStatus *.cpp | sed 's/^.*cpp:\s*//g' |sort -u
/* Some i.e for newStatus signal
1xx is for BBS class
emit newStatus(101, "Trying to login server...");
emit newStatus(102, "Login successful!");
emit newStatus(103, "Cookies seared. Sending login message.");
emit newStatus(104, "Login Failed.");

emit newStatus(111, "Trying to logout...");
emit newStatus(112, "Logout successful.");

emit newStatus(121, "Check if there are new boards...");

2xx is for Board class
emit newStatus(201, "Check if there are new topics...");

emit newStatus(211, "Sending a article...");

3xx is for Topic class
*/

#endif
